package com.example.customview;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;

public class WrapContentHeightViewPager extends ViewPager{
	private int multi = 2;  
    /** 
     * Constructor 
     * 
     * @param context the context 
     */  
    public WrapContentHeightViewPager(Context context) {  
        super(context);  
    }  
  
    /** 
     * Constructor 
     * 
     * @param context the context 
     * @param attrs the attribute set 
     */  
    public WrapContentHeightViewPager(Context context, AttributeSet attrs) {  
        super(context, attrs);  
    }  
  
    @Override  
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {  
  
//        int height = 0;  
//        for (int i = 0; i < getChildCount(); i++) {  
//            View child = getChildAt(i);  
//            child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));  
//            int h = (CalculateTool.getInstance().AppViewHeight)*multi;  
//            if(h > height) {  
//                height = h;  
//            }  
//        }  
//        heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);  
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);  
    }  
  
    public int getMulti() {  
        return multi;  
    }  
  
    public void setMulti(int multi) {  
        this.multi = multi;  
    }  
}
